package oop2.Task2;

public class Driver {
    String name;
    int driveAge;   //驾龄

    public Driver(String name, int driveAge) {
        this.name = name;
        this.driveAge = driveAge;
    }

    //驾驶这种行为，是驾驶员的行为，所以驾驶的方法要写在驾驶员类中
    public void drive(Car a) {
        System.out.println(name + "驾驶小轿车在马路上飙车，车辆信息:");
        a.show();
    }

    public void drive(Airplane a) {
        System.out.println(name + "驾驶飞机，飞机信息:");
        a.show();
    }

    public void drive(Tank a) {
        System.out.println(name + "驾驶坦克，坦克信息:");
        a.show();
    }

    public void drive(Tractor a) {
        System.out.println(name + "驾驶拖拉机，拖拉机信息:");
        a.show();
    }

    public void drive(Ship a) {
        System.out.println(name + "驾驶轮船，轮船信息:");
        a.show();
    }
}
